package com.ydkfjs.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.ydkfjs.common.Result;
import com.ydkfjs.model.dto.UserRegisterRequest;
import com.ydkfjs.service.UserService;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
//import javax.validation.Valid;

/**
 * @Author: hb
 * @CreateTime: 2024-04-02 12:02
 * @Version: 1.0
 */
@Api(tags = "用户模块")
@RestController
@RequestMapping("/user")
public class UserController {

    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    @PostMapping("/register")
    @SaIgnore
    public Result<?> userRegister(@RequestBody UserRegisterRequest userRegisterRequest, HttpServletRequest httpServletRequest) {
        userService.register(userRegisterRequest, httpServletRequest);
        return Result.success("注册成功!");
    }
}
